package com.itheima.mall.service.ums;

import com.itheima.mall.api.ums.UmsRoleMenuRelationServiceApi;
import com.itheima.mall.api.ums.UmsRoleResourceRelationServiceApi;
import com.itheima.mall.api.ums.UmsRoleServiceApi;
import com.itheima.mall.pojo.ums.UmsRole;
import com.itheima.mall.vo.R;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

@Service
public class UmsRoleService {

    @DubboReference
    UmsRoleServiceApi umsRoleServiceApi;

    @DubboReference
    UmsRoleMenuRelationServiceApi umsRoleMenuRelationServiceApi;

    @DubboReference
    UmsRoleResourceRelationServiceApi umsRoleResourceRelationServiceApi;

    public R UmsRoleCreate(UmsRole umsRole) {
        return umsRoleServiceApi.UmsRoleCreate(umsRole);
    }

    public R UmsRoleDelete(Long[] ids) {
        return umsRoleServiceApi.UmsRoleDelete(ids);
    }

    public R UmsRoleList(String keyword, Integer pageNum, Integer pageSize) {
        return umsRoleServiceApi.UmsRoleList(keyword,pageNum,pageSize);
    }

    public R UmsRoleListAll() {
        return umsRoleServiceApi.UmsRoleListAll();
    }

    public R UmsRoleUpdate(Long id, UmsRole umsRole) {
        return umsRoleServiceApi.UmsRoleUpdate(id,umsRole);
    }

    public R UmsRoleUpdateStatus(Long id, Integer status) {
        return umsRoleServiceApi.UmsRoleUpdateStatus(id,status);
    }

    public R UmsRoleAllocMenu(Long[] menuIds, Long roleId) {
        return umsRoleMenuRelationServiceApi.UmsRoleAllocMenu(menuIds,roleId);
    }

    public R UmsRoleAllocResource(Long[] resourceIds, Long roleId) {
        return umsRoleResourceRelationServiceApi.UmsRoleAllocResource(resourceIds,roleId);
    }

    public R UmsRoleListMenu(Long id) {
        return umsRoleMenuRelationServiceApi.UmsRoleListMenu(id);
    }

    public R UmsRoleListResource(Long id) {
        return umsRoleResourceRelationServiceApi.UmsRoleListResource(id);
    }
}
